#cmake 
cmake_minimum_required(VERSION 2.6)
project(learn_opengl)

find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)

if( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR )
    message(fatal_error "Please select another build directory")
endif()

#compile external dependencies
add_subdirectory(external)

include_directories(
    external/glfw-2.7.6/include/
    external/glm-0.9.4.0/
    external/glew-1.9.0/include/
    external/AntTweakBar-1.6/include/
    external/assimp-3.0.1270/include/
    external/bullet-2.81-rev2613/src/
    .
    ${GLUT_INCLUDE_DIRS}
    )

set(ALL_LIBS
    ${OPENGL_LIBRARY}
    ${GLUT_LIBRARY}
    GLFW_276
    GLEW_190
    )
add_definitions(
    -DTW_STATIC
    -DTW_NO_LIB_PRAGMA
    -DTW_NO_DIRECT3D
    -DGLEW_STATIC
    -D_CRT_SECURE_NO_WARNINGS
)

#01
add_executable(01_first_window
    01_first_window/01.cpp
    )
target_link_libraries(01_first_window
    ${ALL_LIBS}
    )

#02
add_executable(02_red_triangle
    02_red_triangle/02.cpp
    common/shader.cpp
    common/shader.hpp
    02_red_triangle/SimpleFragmentShader.fragmentshader
    02_red_triangle/SimpleVertexShader.vertexshader
    )
target_link_libraries(02_red_triangle
    ${ALL_LIBS}
    )

#03
add_executable(03_matrices
    03_matrices/03.cpp
    common/shader.cpp
    common/shader.hpp
    
    03_matrices/SingleColor.fragmentshader
    03_matrices/SimpleTransform.vertexshader
    )
target_link_libraries(03_matrices ${ALL_LIBS}
    )
